I have a workbook that provides drop down list data to group of worksheets. It needs to be open, but I did not want it visible to the user. So, I open it as:
Sub Auto_Open()
Application.ScreenUpdating = False
Set w = Workbooks
w.Open Filename:="P:\Troy Personnel\2016\Summary\Personnel Budget Data.xlsm", UpdateLinks:=False, ReadOnly:=True 'this is the data file were going to be opening
ActiveWindow.Visible = False
ThisWorkbook.Activate
Application.ScreenUpdating = True
End Sub
This works perfectly. However, when the user closes Excel, it asks them to Save the file. I do not want them to do that, which is why I opened in read-only mode. They still can't save the file, but it is a prompt that I wanted to suppress. I tried this:
Sub CloseandSave()
w.Close SaveChanges:=False
End Sub
and this:
Sub Workbook_BeforeClose(Cancel as Boolean)
w.Close SaveChanges:=False
End Sub
Neither work, and I tried to place messages into the close and it looks like it is not even running. Please help this is a major pain!
Regards,
David